package com.example.mvpdemo.simple3;

import com.example.mvpdemo.simple3.base.BasePresenter_3;

/**
 * p层
 * 特点一：持有M层引用
 * 特点二：持有V层引用
 * 特点三：对M层和V层进行关联
 */
public class WeatherPresenter_3 extends BasePresenter_3 {

    private WeatherModel_3 weatherModel;


    public WeatherPresenter_3( ) {
        this.weatherModel = new WeatherModel_3();

    }


    public void weeather(String cityname) {

        this.weatherModel.weather(cityname, new WeatherModel_3.onResult() {
            @Override
            public void success(String result) {
                if (getWeatherView() != null)
                    getWeatherView().onWeatherGetSuccess(result);
            }

            @Override
            public void fail(String result) {
                if (getWeatherView() != null)
                    getWeatherView().onWeatherGetFail(result);
            }
        });
    }

}
